﻿using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Microsoft.WowAddonStudio.FrameXml.Serialization.Attributes;
using Microsoft.WowAddonStudio.FrameXml.Serialization.Enumerations;

namespace Microsoft.WowAddonStudio.FrameXml.Serialization.LayoutFrames
{
    [Serializable]
    [DesignerCategory("code")]
    [XmlType(Namespace = "http://www.blizzard.com/wow/ui/")]
    [XmlRoot(Namespace = "http://www.blizzard.com/wow/ui/", IsNullable = false)]
    public class Model : Frame
    {
        /// <summary>
        /// Gets or sets the color the fog.
        /// </summary>
        [XmlElement]
        [Category("Appearance")]
        [EditorBrowsable]
        [Description("Indicates the color of the fog.")]
        [Color]
        public Color FogColor
        {
            get { return Properties.GetValue<Color>("FogColor"); }
            set { Properties.SetValue("FogColor", value); }
        }

        /// <summary>
        /// Gets or sets the file of the model.
        /// </summary>
        [XmlAttribute("file")]
        [Category("Appearance")]
        [File(FileType.Model)]
        [Description("This refers to a file used by element, path is relative to scheme path: if addon is in \"MyAddon\" folder file specified \"myfile.lua\" will be searched in this folder (i guess only, needs testing). \"\\Interface\\Wherever\" seems to be the same as \"Interface\\Wherever\" (\"C:\\{{WoW}}\\Interface\\Wherever\").")]
        public string File
        {
            get { return Properties.GetValue<string>("File"); }
            set { Properties.SetValue("File", value); }
        }

        /// <summary>
        /// Gets or sets the scale of the model.  The default is 1.
        /// </summary>
        [XmlAttribute("scale")]
        [DefaultValue(1f)]
        [Category("Appearance")]
        [Description("Sets the scale. Default is the parent's scale. Accepts values greater than and not equal to 0.")]
        public float Scale
        {
            get { return Properties.GetValue<float>("Scale"); }
            set { Properties.SetValue("Scale", value); }
        }

        /// <summary>
        /// Gets or sets a value indicating where the fog should start. The default is 0.
        /// </summary>
        [XmlAttribute("fogNear")]
        [DefaultValue(0f)]
        [Category("Appearance")]
        [Description("Defines a value indicating where the fog should start. The default is 0.")]
        public float FogNear
        {
            get { return Properties.GetValue<float>("FogNear"); }
            set { Properties.SetValue("FogNear", value); }
        }

        /// <summary>
        /// Gets or sets a value indicating where the fog shouldend. The default is 1.
        /// </summary>
        [XmlAttribute("fogFar")]
        [DefaultValue(1f)]
        [Category("Appearance")]
        [Description("Defines a value indicating where the fog shouldend. The default is 1.")]
        public float FogFar
        {
            get { return Properties.GetValue<float>("FogFar"); }
            set { Properties.SetValue("FogFar", value); }
        }

        /// <summary>
        /// Gets a value indicating whether a serialization object is complete and can be rendered.
        /// </summary>
        /// <value></value>
        public override bool IsComplete
        {
            get
            {
                return this.Backdrop != null && this.Backdrop.IsComplete;
            }
        }
    }
}